﻿/**
 * @file std_debug.h
 * Copyright (c) 2019 Gaaagaa. All rights reserved.
 * 
 * @author  : Gaaagaa
 * @date    : 2019-09-09
 * @version : 1.0.0.0
 * @brief   : 声明调试信息的相关配置宏。
 */

/**
 * The MIT License (MIT)
 * Copyright (c) Gaaagaa. All rights reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef __STD_DEBUG_H__
#define __STD_DEBUG_H__

////////////////////////////////////////////////////////////////////////////////

#ifndef XSTD_DEBUG_LEVEL
#define XSTD_DEBUG_LEVEL   4
#endif // XSTD_DEBUG_LEVEL

#define XSTD_DEBUG_LOWER   1
#define XSTD_DEBUG_MIDDLE  2
#define XSTD_DEBUG_HIGHER  3
#define XSTD_DEBUG_FULL    4

////////////////////////////////////////////////////////////////////////////////

#define XSTD_DEBUG_ENABLE     (XSTD_DEBUG_LEVEL >= XSTD_DEBUG_LOWER)

#if (XSTD_DEBUG_LEVEL >= XSTD_DEBUG_LOWER)
#include <assert.h>
#define XASSERT(expression)   assert(expression)
#else // XSTD_DEBUG_LOWER
#define XASSERT(expression)
#endif // XSTD_DEBUG_LOWER

#if (XSTD_DEBUG_LEVEL >= XSTD_DEBUG_MIDDLE)
#define MASSERT(expression)   XASSERT(expression)
#else // XSTD_DEBUG_MIDDLE
#define MASSERT(expression)
#endif // XSTD_DEBUG_MIDDLE

#if (XSTD_DEBUG_LEVEL >= XSTD_DEBUG_HIGHER)
#define HASSERT(expression)   XASSERT(expression)
#else // XSTD_DEBUG_HIGHER
#define HASSERT(expression)
#endif // XSTD_DEBUG_HIGHER

#if (XSTD_DEBUG_LEVEL >= XSTD_DEBUG_FULL)
#define FASSERT(expression)   XASSERT(expression)
#else // XSTD_DEBUG_HIGHER
#define FASSERT(expression)
#endif // XSTD_DEBUG_HIGHER

////////////////////////////////////////////////////////////////////////////////

#endif // __STD_DEBUG_H__

